package com.java01.apache.commons.collections;

import java.util.Iterator;

import org.apache.commons.collections.Buffer;
import org.apache.commons.collections.buffer.UnboundedFifoBuffer;

public class QueueAndBuffer {

	public static void main(String[] args) {
		Buffer buffer = new UnboundedFifoBuffer();
		buffer.add("A");
		buffer.add("B");
		buffer.add("C");
		buffer.add("D");

		System.out.println("1. "+buffer.remove());
		System.out.println("2. "+buffer.remove());

		dumpBuffer(buffer);
	}
	
	public static void dumpBuffer(Buffer buffer){
		System.out.println();
		Iterator<String> it = buffer.iterator();
		while(it.hasNext()){
			System.out.println(it.next());
		}
	}
}
